package com.ktjy.config;

import com.ktjy.task.MyQuartzJob;
import org.quartz.*;

//@Configuration
public class QuartzConfig {
//    @Bean
    public JobDetail jobDetail(){
        return JobBuilder.newJob(MyQuartzJob.class)
                .withIdentity("myJob")
                .storeDurably()
                .build();//设置任务的名字
    }

//    @Bean
    public Trigger trigger(JobDetail jobDetail){
        return TriggerBuilder.newTrigger()
                .withIdentity("myTrigger") //设置规则名称
                .forJob(jobDetail) //设置规则作用任务
                .withSchedule(CronScheduleBuilder.cronSchedule("0/10 * * * * ?")) //规则内容
                .build();
    }

}
